Skip to content

Add "Decode/Encode DNS Wire Format" operations (Resolves #940)#2256

Open
rayane-ara wants to merge 2 commits intogchq:masterfrom
rayane-ara:feature/dns-wire-format
Open

Add "Decode/Encode DNS Wire Format" operations (Resolves #940)#2256
rayane-ara wants to merge 2 commits intogchq:masterfrom
rayane-ara:feature/dns-wire-format

Conversation

@rayane-ara
Copy link
Copy Markdown

This PR introduces two new operations to the Networking category: Decode DNS Wire Format and Encode DNS Wire Format.

Summary

It resolves issue #940 by allowing users to decode a binary DNS wire format message (RFC 1035) into readable plaintext (similar to the output of dig), and conversely, encode plaintext back into binary.

This is highly useful for analyzing DNS over HTTPS (DoH) or DNS over TLS (DoT) payloads.

Note: Because these operations work directly with raw binary data (byteArray), you will typically chain them with From Hex or To Hex when manipulating hexadecimal string representations in the Input/Output panels.

Example 1: Decode

Recipe: From Hex -> Decode DNS Wire Format

Input:

00 00 01 00 00 01 00 00 00 00 00 00 03 77 77 77
07 65 78 61 6d 70 6c 65 03 63 6f 6d 00 00 01 00
01

Output:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 0
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.example.com.		IN	A

Example 2 : Encode

Recipe: Encode DNS Wire Format -> To Hex

Input:

www.example.com

Output:

00 00 01 00 00 01 00 00 00 00 00 00 03 77 77 77 07 65 78 61 6d 70 6c 65 03 63 6f 6d 00 00 01 00 01

@GCHQDeveloper581 GCHQDeveloper581 linked an issue Mar 21, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

@GCHQDeveloper581 GCHQDeveloper581 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please could you add some tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Operation request: Decode/Encode DNS Wire Format

2 participants